<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button>发送请求</button>
    <button>取消请求</button>
</body>
<script type="module">
    const btns = document.querySelectorAll('button');
    let xhr;
    btns[0].onclick = function () {
        btns[1].click();
        axios({
            timeout:1000,
            url:'http://192.168.137.1.com/scoreList',
            cancelToken:new axios.CancelToken(cancel=>btnCancel=cancel)
        }).then(value=>{
            console.log(value.data)
        }).catch(err=>{
            console.log(err,axios.isCancel(err));
        })
    }
    btns[1].onclick = function () {
        if(btnCancel) btnCancel();
    }
</script>
</html>